#if !defined(_CADEBUG_H_)
#define _CADEBUG_H_

#include <stdarg.h>

typedef enum enumLogLevel
{
    LL_Error = 0,
    LL_Warning,
    LL_Info,
    LL_Debug,
}
ELogLevel;

class CADebug
{
protected:
	static ELogLevel _log_level;

	static void _trace(ELogLevel level, const char* fmt, va_list vlist);
public:
	static void setTraceLevel(ELogLevel l);

	static void Assert(const char* pszCondition, const char* pszFile, const char* pszFunction, int line);

	static void Error(const char* fmt, ...);
	static void Warning(const char* fmt, ...);
	static void Info(const char* fmt, ...);
	static void Debug(const char* fmt, ...);
};

#if defined(_DEBUG)
#	define _Assert(a)	((a) ? (void)0 : CADebug::Assert(#a, __FILE__, __FUNCTION__, __LINE__))
#	define _Verify(a)	((a) ? (void)0 : CADebug::Assert(#a, __FILE__, __FUNCTION__, __LINE__))
#else
#	define _Assert(a)	(void)0
#	define _Verify(a)	(a)
#endif

#define _Error(fmt, ...)	CADebug::Error	(fmt, ##__VA_ARGS__)
#define _Warning(fmt, ...)	CADebug::Warning(fmt, ##__VA_ARGS__)
#define _Info(fmt, ...)		CADebug::Info	(fmt, ##__VA_ARGS__)
#define _Debug(fmt, ...)	CADebug::Debug	(fmt, ##__VA_ARGS__)
#define _Trace(fmt, ...)	CADebug::Debug	(fmt, ##__VA_ARGS__)

#endif //_CADEBUG_H_
